const btn = document.querySelector('#btnChoose')
const img = document.querySelector('.img-thumbnail')
const file = document.querySelector('#iptFile')

btn.addEventListener('click',function () {
    file.click()
})
file.addEventListener('change',async function () {
        const fd = new FormData()
        if (!this.files[0]) {
            return alert('数据为空！')
        }
        fd.append('avatar',this.files[0])
        const response = await axios.post('http://ajax-api.itheima.net/api/file',fd)
        img.src = response.data.data.url
    })
